// IpAccessStatesShowUserDlg.cpp: implementation of the CIpAccessStatesShowUserDlg class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "IpAccessStatesShowUserDlg.h"

#include "eDASexpressApp.h"

extern CEDASexpressApp theApp;

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CIpAccessStatesShowUserDlg::CIpAccessStatesShowUserDlg(const CString &strRoleName, CWnd* pParent /*=NULL*/)
	: CIpAccessStatesShowUserGroupDlg(strRoleName, pParent)
{
}

CIpAccessStatesShowUserDlg::~CIpAccessStatesShowUserDlg()
{

}

CStringItemsArray CIpAccessStatesShowUserDlg::GetRoles(const CString &strUserName)
{
	CUser *pUser= NULL;
ASSERT(NULL != theApp.m_pMainDlg);
ASSERT(NULL != theApp.m_pMainDlg->m_KUser.m_puserpages);
		theApp.m_pMainDlg->m_KUser.m_puserpages->CheckRefresh();
		CArray<CUser, CUser&> &arrUsers= theApp.m_pMainDlg->m_KUser.m_puserpages->m_upCurrentPage.m_arrItems;
		for (int iSearch= 0; iSearch < arrUsers.GetSize(); iSearch++)
		{
			if (strUserName == arrUsers[iSearch].m_strUserName)
			{
				pUser = &(arrUsers[iSearch]);
				break;
			}
		}
	if (NULL == pUser)
		return (CStringItemsArray());

	CStringItemsArray arrSpecialRoles(pUser->m_strSpecialRoles);
		CStringItemsArray &arrDefaultRoles= GetGroupDefaultRoles( pUser->m_strGroup );
		arrSpecialRoles.Merge( arrDefaultRoles );
return (arrSpecialRoles);
}
